/*
 * Copyright 2000-2011 Worth Enterprises, Inc.  All Rights Reserved.
 */
package com.worthent.foundation.util.state;

/**
 * Specifies methods implemented by objects that need to do something when a
 * state table transitions from one state to another.
 * 
 * @author Erik K. Worth
 * @version $Id: StateTransitioner.java 2 2011-11-28 00:10:06Z erik.k.worth@gmail.com $
 */
public interface StateTransitioner {
    /**
     * Returns the name of the StateTransitioner for logging purposes.
     */
    String getName();

    /**
     * This method is called once by the state table when a state transition
     * completes.
     * 
     * @param fromState string ID of the state the table is transitioning from.
     * @param toState string ID of the state the table is transitioning to.
     * @param table the state table instance
     * @param event the event that triggered the transition
     * 
     * @exception StateExeException thrown when the onTransition method fails
     *            (it will prevent the state transition).
     */
    void onTransition(
        String fromState,
        String toState,
        StateTable table,
        StateEvent event) throws StateExeException;

}
